<template>
	<view>
		<nav-bar fontColor="#FFFFFF" title="产品开通"></nav-bar>
		<view class="topStep">
			<uni-steps :options="list1" :active="active1" />
		</view>
		<!-- <uni-forms-item required label="近12月营业收入">
			<uni-easyinput v-model="form.remark" placeholder="请输入近12月营业收入" />
		</uni-forms-item>
		<uni-forms-item required label="合作年限(年)">
			<uni-easyinput v-model="form.needCredit" placeholder="请输入合作年限(年)" />
		</uni-forms-item> -->
		<view v-if="active1 == 0">
			<!-- <view class="centerBoxtitle">补充资料</view>
			
			<uni-section title="输入数据" type="line">
				<view class="example">
					<uni-forms ref="baseForm" :model="form" labelWidth="400px" labelPosition="top">
						<uni-forms-item required label="产品名称">
							<uni-easyinput v-model="form.productName" :disabled="true" placeholder="请输入产品名称" />
						</uni-forms-item>
						<uni-forms-item required label="申请信用额">
							<uni-easyinput v-model="form.needCredit" placeholder="请输入信用额" />
						</uni-forms-item>
						<uni-forms-item required label="申请理由">
							<uni-easyinput v-model="form.applyReason" placeholder="请输入申请理由" />
						</uni-forms-item>
						<uni-forms-item required label="备注">
							<uni-easyinput v-model="form.remark" type="textarea" placeholder="请输入备注" />
						</uni-forms-item>
					</uni-forms>
				</view>
			</uni-section> -->
			<view style="height: 120rpx;">
				<view class="bottomBox">
					<view class="buttonBox">
						<button class="button_fix" size="default" @click="nextStep">下一步</button>
					</view>
				</view>
			</view> 
		</view>
		<view v-else-if="active1 == 1">
			<view class="centerBoxtitle">签署合同</view>
			<uni-card>
				<view>暂无合同签署，请点击“下一步'</view>
			</uni-card>
			<view style="height: 120rpx;">
				<view class="bottomBox">
					<view class="buttonBox">
						<button class="button_fix" size="default" @click="backStep">上一步</button>
						<button class="button_fix" size="default" @click="submit">下一步</button>
					</view>
				</view>
			</view> 
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				id: null,
				active1: 1,
				productName: null,
				list1: [{
					title: '补充资料'
				}, {
					title: '签署合同'
				}, {
					title: '业务审批'
				}, {
					title: '获得额度'
				}],
			}
		},
		onLoad(e) {
			let params = JSON.parse(e.params)
			console.log(params)
			this.id = params.id
			this.productName = params.productName
		},
		methods:{
			nextStep(){
				this.active1 = 1;
			},
			backStep(){
				this.active1 = 0;
			},
			test(){
				let opt = {
					url:'finance/jd/pushAccessCustInfo/'+ uni.getStorageSync('userInfo').customerId,
					method:'POST'
				};
				this.$http.httpTokenRequest(opt,{}).then(res =>{
					
				})
			},
			submit(){
				let opt = {
					url:'baoli/finCustomerCreditApplication/activate/'+ this.id,
					method:'POST'
				};
				this.$http.httpTokenRequest(opt,{}).then(res =>{
					if(res.data.code == 200){
						uni.showToast({
							title: res.data.msg,
							icon:'success',
							duration: 1500
						});
						if(this.productName == '酒易贷'){
							uni.navigateTo({
								url:'/pages/login/jdLogin?type=productApply'
							})
						}
						else{
							uni.navigateTo({
								url:'/pages/limit/qrCode'
							})
						}
						// setTimeout(()=>{
						// 	uni.navigateBack({
						// 		delta: 2
						// 	})
						// },1500)
					}
					else{
						uni.showToast({
							title: res.data.msg,
							icon:'error',
							duration: 1500
						});
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background: #f4f4f4;
	}
	.topStep{
		display: flex;
		width: 100%;
		height: 150rpx;
		background: #fff;
		align-items: center;
	}
	.centerBoxtitle {
		font-size: 35rpx;
		color: #000000;
		font-weight: bold;
		margin: 28rpx;
	
	}
	.example {
		padding: 20rpx;
		background: #fff;
	}
	.bottomBox{
		position: fixed;
		width: 100%;
		bottom: 0;
		margin-bottom: 20rpx;
		z-index: 1000;
	}
	.buttonBox {
		width: 100%;
		margin: 0 auto;
		display: flex;
		justify-content: space-around;
		
		// margin-top: 200rpx;
	}
	
	.button_fix {
		width: 90%;
		height: 70rpx;
		margin: 20rpx;
		// margin: 0 auto;
		color: #FFFFFF;
		background: #2749C8;
		font-weight: bold;
		letter-spacing: 5rpx;
		font-size: 28rpx;
		line-height: 70rpx;
	}
</style>